home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / bin / forum / snt2wsnt < prev    next >
Text File  |  1996-11-11  |  3KB  |  80 lines

  1. #!/bin/nawk -f
  2. # convert snt (showcase based) to wsnt (web based)
  3.  
  4. BEGIN {if ( ! slug ) slug="filename";
  5.        getline;
  6.        streams = $0;
  7.        print streams;
  8.  
  9.        getline;
  10.        scfile=$0;
  11.        printf "%s%s.html\n", dir, slug;
  12.     
  13.        getline;
  14.        audiofile = $0;
  15.        printf "%s.mpga\n", slug;
  16.  
  17.        if(make_event_titles != 0){
  18.          event_file = "event.titles";
  19.          system( "rm -f " event_file);
  20.        }
  21.  
  22.       pg=0;page=1;pi=1;printf "NETSCAPE BEGIN 1\n";
  23.        }
  24.  
  25. !/^#/ {
  26.        sub(/advancedVRML2/,"HTML");sub(/http:..snt.*HTML/,dir "HTML");
  27.        if ($2 == "FORWARD") {pi= 1;print_it($3)};
  28.        if ($2 == "REVERSE") {pi=-1;print_it($3)};
  29.        if ($2 == "BEGIN")   {page=1;
  30.                          #printf  "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg++, 1;
  31.                          #print_it(1);
  32.                              }
  33.        if ($1 == "SNAP") {pi= 1;print_it($3);
  34.                           tmp = sprintf("ln -sf %s %s%03d.rgb", $2, slug, pg);
  35.                           system (tmp);};
  36.        if ($1 == "NETSCAPE") {print $0; pi=1; print_it(0.01);
  37.                           tmp = sprintf("if [ -r %s ]; then cp %s %s%03d.rgb; fi", "foo.rgb", "foo.rgb", slug, pg);
  38.                           system (tmp);};
  39.        }
  40.  
  41. END {pi=1;print_it(1);#printf  "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg, 1000;
  42.      }
  43.  
  44. function print_it(foo){
  45.     do_quick_removal = 5000;
  46.     pg++;
  47.     if (foo != 0.01) {
  48.       if (foo <= do_quick_removal) {
  49.          skip_quick_events += foo;
  50.          printf  "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg, 0;
  51.       } else {
  52.          printf  "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, pg, foo+skip_quick_events;
  53.          skip_quick_events = 0;
  54.       }
  55.     }
  56.     if(make_event_titles != 0){
  57.       tmp=sprintf("make_csnt %d > %s%03d.csnt", pg, slug, pg);
  58.       system(tmp);
  59.       tmp=sprintf("echo %d\\    %d\\    `take_line line=%d < slides.titles` >> %s", pg, page, page, event_file);
  60.       system(tmp);
  61.     }
  62.     page = page + pi;
  63. }
  64.  
  65. ##foo# !/^#/ {
  66. ##foo#        if ($2 == "FORWARD") { page++;}
  67. ##foo#        if ($2 == "REVERSE") { page--;}
  68. ##foo#        if ($2 != "BEGIN"){pg++;
  69. ##foo#         printf  "%sNETSCAPE %s%s%03d.html %s\n", "", dir, slug, page, $3;
  70. ##foo#     tmp=sprintf("make_csnt %d > %s%03d.csnt", pg, slug, pg);
  71. ##foo#     system(tmp);
  72. ##foo#     tmp=sprintf("take_line line=%d < slides.titles >> %s", page, event_file);
  73. ##foo#     system(tmp);
  74. ##foo#     }
  75. ##foo#        }
  76. ##foo# 
  77. ##foo# END {tmp = slug ".event_count";
  78. ##foo#      printf ("%d\n", pg) > tmp;}
  79. ##foo# 
  80.